package com.ciallo.stock.job;

import com.ciallo.stock.service.StockTimerTaskService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 42088
 * @version 1.0
 * @description: 定义xxljob任务执行器的bean
 * @date 2025/3/3 9:55
 */
@Component
public class StockJob {
    @Autowired
    StockTimerTaskService stockTimerTaskService;

    @XxlJob("myJobHandler")
    public void demoJobHandler() throws Exception{
        System.out.println("hello!");
    }

    /**
     * 定时采集A股大盘数据
     * 建议：针对不同的股票数据，定义不同的采集任务，解耦，方便维护
     */
    @XxlJob("getInnerMarketInfo")
    public void getStockInfos(){
        stockTimerTaskService.getInnerMarketInfo();

    }

    @XxlJob("getStockRtIndex")
    public void getStockRtIndex(){
        stockTimerTaskService.getStockRtIndex();
    }

}
